/** @jsxRuntime automatic */
/** @jsxImportSource ../xml-runtime */
import { NTSC } from './NTSC'

function Video({ mediaInfo }) {
  return (
    <format>
      <samplecharacteristics>
        <rate>
          <timebase>{mediaInfo.frameRate}</timebase>
          <NTSC value={mediaInfo.ntsc}></NTSC>
        </rate>
        <codec>
          <name>Apple ProRes 422</name>
          <appspecificdata>
            <appname>Final Cut Pro</appname>
            <appmanufacturer>Apple Inc.</appmanufacturer>
            <appversion>7.0</appversion>
            <data>
              <qtcodec>
                <codecname>Apple ProRes 422</codecname>
                <codectypename>Apple ProRes 422</codectypename>
                <codectypecode>apcn</codectypecode>
                <codecvendorcode>appl</codecvendorcode>
                <spatialquality>1024</spatialquality>
                <temporalquality>0</temporalquality>
                <keyframerate>0</keyframerate>
                <datarate>0</datarate>
              </qtcodec>
            </data>
          </appspecificdata>
        </codec>
        <width>{mediaInfo.width}</width>
        <height>{mediaInfo.height}</height>
        <pixelaspectratio>square</pixelaspectratio>
      </samplecharacteristics>
    </format>
  )
}

function Audio({ mediaInfo }) {
  return (
    <format>
      <samplecharacteristics>
        <depth>{mediaInfo.depth}</depth>
        <samplerate>{mediaInfo.sampleRate}</samplerate>
      </samplecharacteristics>
    </format>
  )
}

export const Format = { Video, Audio }
